﻿using System;
using System.Collections.Generic;

using System.Text;

namespace TdgMaker.DataType
{
    class TrackData
    {
        public string SNameTName = "";
        public int TrackLoc = 0;
        public string Type = "";
        public int Length = 0;
        public string CF = "";
        public bool selected = false;
        public int myPos = 0;
        public bool isNotReverse = false;
        public bool isDown = false;
        public string SignalName = "";
        public bool isInStation = false;

        public void SetSNameTName(string s, string t)
        {
            //int a = s.IndexOf(" ");
            //s = s.Remove(0, a);
            //s = s.Replace(" ", "_");
            s = StationName.TranName(s);
            t = t.Replace(" ", "_");
            SNameTName = s + "&" + t;
        }

        public void SetTrackLoc(string s)
        {
            s = s.Replace(" ", "");
            s = s.Replace("K", "");
            s = s.Replace("k", "");
            s = s.Replace("+", "");
            TrackLoc = Convert.ToInt32(s, 10);
        }

        public string getStationName()
        {
            string[] ss = SNameTName.Split('&');
            return ss[0];
        }

        public string getTrackName()
        {
            string[] ss = SNameTName.Split('&');
            return ss[1];
        }

        public string getCF()
        {
            string s = "00";

            if (CF == "0") s = "00";
            if (CF == "1700-1") s = "01";
            if (CF == "2000-1") s = "02";
            if (CF == "2300-1") s = "03";
            if (CF == "2600-1") s = "04";
            if (CF == "1700-2") s = "05";
            if (CF == "2000-2") s = "06";
            if (CF == "2300-2") s = "07";
            if (CF == "2600-2") s = "08";

            return s;
        }

        internal string getUpDown()
        {
            if (isDown)
            {
                return "Down Line";
            }
            else
            {
                return "Up Line";
            }
        }

        internal string getReverse()
        {
            if (isNotReverse)
            {
                return "Forward";
            }
            else
            {
                return "Reverse";
            }
        }
    }
}
